﻿using System.Windows;
using System.Windows.Controls;
using SomethingSpacial.ViewModel;


namespace SomethingSpacial.Views.Admin
{
    public partial class LocationAdd : ChildWindow
    {
        public LocationsViewModel NewLocation { get; set; }

        public LocationAdd()
        {
            InitializeComponent();
            Loaded += new RoutedEventHandler(this_Loaded);
        }

        void this_Loaded(object sender, RoutedEventArgs e)
        {
            NewLocation = new LocationsViewModel();

            NewLocation.LocationID = 0;
            NewLocation.LocationName = "New Location";

            addDataForm.CurrentItem = NewLocation;
            addDataForm.BeginEdit();    

        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            addDataForm.CommitEdit();	
            this.DialogResult = true;
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            NewLocation = null;
            addDataForm.CancelEdit();
            this.DialogResult = false;
        }

    }
}

